-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create DAO and New Endpoints for Program Mentorship Relationship #22
base: ms-backend-server
Are you sure you want to change the base?
Conversation
@mtreacy002 Please have a look at the logic and codes. This is ongoing and I will make the changes in the text/swagger docs later? Will that work? Actually, I wanted to seek your green signal on this. I have checked
This is a little bit different from the gists. However, we may have one small problem and that is this case: Both the time when a program sends successful second request to a mentor or mentee. The database becomes something like
The problem arises while accepting this relation, as (I think )this is the only common case, both mentor or mentee can accept this relation. But, this problem can be solved easily in BIT when we check the relation_extension_model.mentee/mentor_accept_date. Can you suggest me a better way to solve it in MS only. |
@mtreacy002 Also the email templates are not appropriate I will soon create new one too! |
I created only one endpoint for sending both the type of request to anyone regardless of their role. Why I did this?This surely made the logic a bit tough. But on the other hand in BIT it will be easy to use a single endpoint. Just by changing the datas one can easily create the request . Moreover I tried to keep MS logics and validations at MS side and BIT's logics and validations seperate. Let me know what do you think of this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@decon-harsh . Good job submitting this code changes considering this is a complex issue. The feedback below is just the my initial review.
Pointers:
Can you write with fewer lines of code per function? don't try to tackle all tasks in a single function. I'd rather you use about 20 - 30 lines per function. For example the create_program_mentorship_relation
function inside ProgramMentorshipRelationDAO
has about 300 lines of code. This really makes It hard to read. Please divide these into sub functions. Make sure you check other places where you did the same.
So, please make changes to the things I point out here. After that I will check the logic.
required=True, description="Mentorship relation Organization Representative's ID" | ||
), | ||
"relation_id": fields.Integer( | ||
description="Mentorship relation Organization Representative's ID" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this attribute the same with line 55 but just with different name? do we need this attribute?
@@ -137,6 +137,63 @@ def send_email_mentorship_relation_accepted(request_id): | |||
) | |||
send_email(request_sender.email, subject, html) | |||
|
|||
def send_email_program_mentorship_relation_accepted(request_id,org_rep_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we place this in a separate file "bit_email_utils.py" to make it easier for contributors to locate BIT specific email logic from.
MINIMUM_MENTORSHIP_DURATION | ||
""" | ||
|
||
def create_program_mentorship_relation(self, user_id: int, org_rep_id:int , mentor_id:int, mentee_id:int, relation_id:int, data: Dict[str, str]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org_rep_id:int , mentor_id:int, mentee_id:int,
can be removed and placed inside "data"
relation_id:int,
not needed
@mtreacy002 Please have a look! 😄 . I had left the minor changes in swagger docs or writing comments for later as I have my semester exams (Pretty rough week 😆 ). But when I saw you requested changes in DAO I immediately started doing them, Talking about the DAO function I divided it into four smaller functions each with a specific task. I guess everything is working fine. The API endpoint can create requests. The other API endpoint can accept them. I wanted to specifically ask you about request body of the endpoint. I made a single endpoint capable of creating all diff program mentorship relation but we have to give him different data. For example A program sending an initial request to a mentor will look like this { After accepting it { This is acceptable right? as we are going to give data through BIT |
Let me know If you want to discuss anything or tell me anything, we can talk today in BIT open session 😄 |
@decon-harsh , I'll try provide feedback whenever I'm available, but you don't need to feel you have to respond to it/work on the requested change immediately. It's ok to take more time on the issue, especially if you have urgent things like exams. So, please focus on that first. Just update me on your status every 3-4 days (if you need more time, e.g. still in exams, or need time to work on it, etc). Just a heads up, on GSoC, this will be a different story as you made the commitment and will be paid for the GSoC tasks, you're accountable to fulfil the tasks as scheduled on the timeline 😉. |
Hey @mtreacy002 I think there is a problem. Take this scenario
Now, suppose there are two mentees, who want to apply
Am I correct ? If so what should be our approach on this! Moreover i was writing internall calls from BIT and I can assure you user doesn't have to send relation_id field in request body. It will be automatically taken. |
In this situation, we just need to create another MentorshipRelationModel instance on MS backend and a new MentorshipRelationExtentionModel instance on BIT backend (with the same program_id, but different menforship_relation_id) this mentee request. This is because the requests for these 2 mentorship relations are totally separate, the only same thing about them is that they applying to the same program. However, saying that, I just realised I made an error in the MentorshipRelationExtensionModel 😱 .
That's great 👍. It'll be easier to review if we can run the 2 servers (BIT and MS backend and see how they're interacting). |
8988f98
to
8e0e30d
Compare
Description
This is a cross project issue related to Bridge In Tech, For creating a Program-Mentor-Mentee Relation there was a need to create a new DAO and some endpoints to create and accept those relations.
Fixes #19
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
Checklist:
Code/Quality Assurance Only